import request from '@/utils/request'
import apis from './'

export function getIntentList (parameter) {
  return request({
    url: apis.IntentList,
    method: 'get',
    params: parameter
  })
}

export function getPurchaseList (parameter) {
  return request({
    url: apis.PurchaseList,
    method: 'get',
    params: parameter
  })
}

export function getCheckIntent (id) {
  return request({
    url: `${apis.CheckIntent}?intent_id=${id}`,
    method: 'get'
  })
}

export function getCheckPurchase (id) {
  return request({
    url: `${apis.CheckPurchase}?pid=${id}`,
    method: 'get'
  })
}

export function postCheckIntent (id, data) {
  return request({
    url: `${apis.CheckIntent}?intent_id=${id}`,
    method: 'post',
    data: data
  })
}

export function postCheckPurchase (id, data) {
  return request({
    url: `${apis.CheckPurchase}?pid=${id}`,
    method: 'post',
    data: data
  })
}

export function getIntentView (id) {
  return request({
    url: `${apis.IntentView}?intent_id=${id}`,
    method: 'get'
  })
}

export function getPurchaseView (id) {
  return request({
    url: `${apis.PurchaseView}?purchase_id=${id}`,
    method: 'get'
  })
}

export function getTradeList (parameter) {
  return request({
    url: apis.TradeList,
    method: 'get',
    params: parameter
  })
}

export function getTradeView (id) {
  return request({
    url: `${apis.TradeView}?id=${id}`,
    method: 'get'
  })
}
